package create.single;

/**
 * @author lzp
 * @Date:2023/2/24
 * @description: 饿汉式，类被加载时就直接初始化，线程安全
 */
public class Singleton1 {

	private static Singleton1 instance = new Singleton1();

	/**
	 * 私有化构造函数，外部无法访问
	 */
	private Singleton1() {
	}

	/**
	 * 提供获取实例的静态方法
	 */
	public static Singleton1 getInstance() {
		return instance;
	}

}
